<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

$codeTypes = [
    'CODE_TYPE_TEXT' => '文本',
    'CODE_TYPE_BARCODE' => '一维码',
    'CODE_TYPE_QRCODE' => '二维码',
    'CODE_TYPE_ONLY_QRCODE' => '仅显示二维码',
    'CODE_TYPE_ONLY_BARCODE' => '仅显示一维码',
    'CODE_TYPE_NONE' => '不显示任何码型',
];

$colors = [
    'Color010' => '#63b359',
    'Color020' => '#2c9f67',
    'Color030' => '#509fc9',
    'Color040' => '#5885cf',
    'Color050' => '#9062c0',
    'Color060' => '#d09a45',
    'Color070' => '#e4b138',
    'Color080' => '#ee903c',
    'Color081' => '#f08500',
    'Color082' => '#a9d92d',
    'Color090' => '#dd6549',
    'Color100' => '#cc463d',
    'Color101' => '#cf3e36',
    'Color102' => '#5E6671',
];

$this->title = '创建微信会员卡';
$this->params['breadcrumbs'][] = ['label' => '微信会员卡', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<style>
    .colors-label .label{
        margin: 7.5px;
        padding: 1.2em 0.6em 1.3em;
    }
    #membercard-color label{
        margin: 2px;
    }
</style>

<div class="member-card-create">

    <h1><?= Html::encode($this->title) ?></h1>

    <div class="member-card-form">

        <?php $form = ActiveForm::begin(); ?>

        <?= $form->field($model, 'identifier')->textInput(['maxlength' => true, 'value' => Yii::$app->session->get('identifier'), 'readonly' => 'readonly']) ?>

        <?= $form->field($model, 'logo_url')->textInput(['maxlength' => true]) ?>

        <?= $form->field($model, 'code_type')->radioList($codeTypes) ?>

        <?= $form->field($model, 'brand_name')->textInput(['maxlength' => true]) ?>

        <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>

        <?= $form->field($model, 'color')->radioList($colors) ?>

        <div class="form-group colors-label" style="margin-bottom:30px;">
            <?php foreach($colors as $k => $v): ?>
            <span class="label label-default" style="background-color:<?= $v ?>;"><?= $v ?></span>
            <?php endforeach; ?>
        </div>

        <?= $form->field($model, 'notice')->textInput(['maxlength' => true]) ?>

        <?= $form->field($model, 'description')->textarea(['maxlength' => true, 'rows' => 5]) ?>

        <?= $form->field($model, 'prerogative')->textarea(['maxlength' => true, 'rows' => 5]) ?>
        
        <!-- <?= $form->field($model, 'supply_bonus')->radioList(['1' => '不显示', '2' => '显示'], ['readonly' => 'readonly']) ?> -->

        <!-- <?= $form->field($model, 'supply_balance')->radioList(['1' => '不显示', '2' => '显示'], ['readonly' => 'readonly']) ?> -->
        

        <?= $form->field($model, 'wx_activate_after_submit_url')->textInput(['maxlength' => true]) ?>

        <?= $form->field($model, 'quantity')->textInput(['maxlength' => true]) ?>

        <?= $form->field($model, 'cost_money_unit')->textInput(['maxlength' => true]) ?>
        
        <?= $form->field($model, 'increase_bonus')->textInput(['maxlength' => true]) ?>

        <?= $form->field($model, 'max_increase_bonus')->textInput(['maxlength' => true]) ?>

        <?= $form->field($model, 'init_increase_bonus')->textInput(['maxlength' => true]) ?>

        <?= $form->field($model, 'cost_bonus_unit')->textInput(['maxlength' => true]) ?>

        <?= $form->field($model, 'reduce_money')->textInput(['maxlength' => true]) ?>

        <?= $form->field($model, 'least_money_to_use_bonus')->textInput(['maxlength' => true]) ?>

        <?= $form->field($model, 'max_reduce_bonus')->textInput(['maxlength' => true]) ?>

        <div class="form-group">
            <?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
        </div>

        <?php ActiveForm::end(); ?>

    </div>

</div>
